Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Pipe stacks #1017

Merged
merged 1 commit into from
Jan 25, 2025
Merged

[Feature] Pipe stacks #1017

merged 1 commit into from
Jan 25, 2025

Conversation

Roudenn
Copy link
Contributor

@Roudenn Roudenn commented Jan 24, 2025

Ports of following PRs:
Goob-Station/Goob-Station#389
Goob-Station/Goob-Station#391

Стаки труб возвращаются!

Summary by CodeRabbit

  • Новые возможности

    • Добавлена новая настройка StrictPipeStacking для управления правилами размещения труб.
  • Улучшения

    • Разрешено размещение устройств поверх труб.
    • Оптимизирована система обнаружения пересечения труб.
  • Конфигурация

    • Введена новая серверная конфигурация для контроля наложения труб.

Pipe stacks

Pipe stacks

allow device-on-pipe stacking (Rxup#389)

* implement device-on-pipe stack allowage

* missing comments
@Roudenn Roudenn requested a review from Rxup as a code owner January 24, 2025 15:38
Copy link
Contributor

coderabbitai bot commented Jan 24, 2025

Обзор

Walkthrough

Изменения затрагивают систему управления перекрытием труб в игре, вводя новую конфигурационную переменную StrictPipeStacking. Система была модифицирована для более гибкого управления наложением и стыковкой труб. Добавлена возможность настройки правил стыковки через конфигурацию, что позволяет разрешать или запрещать размещение устройств поверх труб в зависимости от выбранных параметров.

Changes

Файл Изменения
Content.Server/Atmos/EntitySystems/PipeRestrictOverlapSystem.cs Добавлена переменная StrictPipeStacking, обновлена логика проверки перекрытия труб
Content.Shared/Backmen/CCVar/CCVars.cs Введена новая конфигурационная переменная StrictPipeStacking
Resources/Prototypes/Entities/... Удален компонент PipeRestrictOverlap для различных сущностей (газовые трубы, циркуляторы и т.д.)

Sequence Diagram

sequenceDiagram
    participant Config as Configuration Manager
    participant PipeSystem as PipeRestrictOverlapSystem
    participant Pipe as Gas Pipe Entity

    Config->>PipeSystem: Update StrictPipeStacking
    PipeSystem->>Pipe: Check Overlap Rules
    alt Strict Stacking Enabled
        PipeSystem-->>Pipe: Prevent Overlapping
    else Strict Stacking Disabled
        PipeSystem-->>Pipe: Allow Conditional Stacking
    end
Loading

Poem

🐰 Трубы, трубы, как река течёт,
Стыковка теперь свободный полёт!
Настройки просты, конфиг наш умён,
Устройства на трубах - разрешён!
Кролик-инженер радостно поёт! 🔧


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Roudenn Roudenn changed the title Pipe stacks [Feature] Pipe stacks Jan 24, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
Content.Server/Atmos/EntitySystems/PipeRestrictOverlapSystem.cs (1)

28-28: Рассмотрите использование свойства вместо публичного поля.

Публичное поле StrictPipeStacking может быть преобразовано в свойство public bool StrictPipeStacking { get; private set; } для лучшей инкапсуляции.

Resources/Prototypes/Entities/Structures/Piping/Atmospherics/pipes.yml (1)

68-74: Хорошее архитектурное решение!

Создание абстрактной сущности GasPipeNoOverlap с компонентом PipeRestrictOverlap обеспечивает более гибкий контроль над ограничениями наложения труб. Это позволяет выборочно применять ограничения там, где они действительно необходимы.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d366ab5 and e49c511.

📒 Files selected for processing (6)
  • Content.Server/Atmos/EntitySystems/PipeRestrictOverlapSystem.cs (4 hunks)
  • Content.Shared/Backmen/CCVar/CCVars.cs (1 hunks)
  • Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml (1 hunks)
  • Resources/Prototypes/Entities/Structures/Piping/Atmospherics/pipes.yml (7 hunks)
  • Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml (2 hunks)
  • Resources/Prototypes/Entities/Structures/Power/Generation/teg.yml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml
⏰ Context from checks skipped due to timeout of 300000ms (2)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: Test Packaging
🔇 Additional comments (15)
Content.Server/Atmos/EntitySystems/PipeRestrictOverlapSystem.cs (9)

7-11: Замечательно!

Новые директивы using выглядят корректно и позволяют использовать необходимые конфигурационные классы.


21-21: Полезная зависимость через IConfigurationManager.

Поле _cfg внедряется корректно, обеспечивая гибкую настройку параметров труб через конфигурацию.


35-35: Убедитесь в корректном управлении событиями при изменении CVar.

Проверите, требуется ли отписка от события при завершении работы системы, чтобы избежать потенциальных утечек или лишних колбэков.


86-87: Инициализация переменной выглядит хорошо.

Логика флагов направления труб (takenDirs = PipeDirection.None) понятна и не вызывает вопросов.


97-103: Отличная интеграция вызова PipeNodesOverlap.

Использование кортежа (overlapping, which) упрощает код, делая его более наглядным.


109-110: Расширение функционала через отдельный метод.

Возвращаемый кортеж (bool, PipeDirection) выглядит удобным средством для определения факта пересечения и совокупных направлений.


121-123: Условное поведение при отключённом StrictPipeStacking.

Понятно, что если StrictPipeStacking == false, дальнейшая проверка не требуется. Логика выглядит согласованной.


128-129: Проверьте корректность использования побитового XOR.

Проверка (dir ^ otherDir) != 0 приводит к прерыванию цикла при любом отличии битов. Убедитесь, что это ожидаемое поведение и что не нужно учитывать отдельные биты по-другому.


133-134: Итоговое условие выглядит логичным.

Если StrictPipeStacking отключён, проверка (takenDirs & entDirsCollapsed) == entDirsCollapsed корректно определяет, заняты ли все направления.

Content.Shared/Backmen/CCVar/CCVars.cs (1)

206-215: Новая переменная конфигурации предоставляет гибкую настройку поведения труб.

StrictPipeStacking добавляет возможность жёсткой проверки наложения труб. Значение по умолчанию false указывает, что изначально жёсткая проверка отключена, что отличный выбор для совместимости.

Resources/Prototypes/Entities/Structures/Power/Generation/teg.yml (1)

179-180: Логичное отключение PipeRestrictOverlap для циркулятора.

Комментирование компонента PipeRestrictOverlap согласуется с новой политикой наложения труб и устройств. Теперь циркулятор можно устанавливать поверх трубы без запрета.

Resources/Prototypes/Entities/Structures/Piping/Atmospherics/pipes.yml (2)

79-80: Последовательное применение изменений в иерархии наследования.

Все базовые типы труб теперь наследуются от GasPipeNoOverlap, что сохраняет исходное поведение ограничений наложения. Изменения применены последовательно и сопровождаются поясняющими комментариями.

Also applies to: 99-100, 133-134, 174-175, 211-212, 248-249


54-55: Проверьте влияние на архитектуру системы труб.

Удаление компонента PipeRestrictOverlap из базового класса GasPipeBase может привести к неожиданному поведению наложения для всех производных сущностей. Рекомендуется проверить, что это изменение не нарушает существующую логику размещения устройств.

✅ Verification successful

Изменение является архитектурно согласованным

Анализ показывает, что отключение компонента PipeRestrictOverlap в базовом классе является частью систематического изменения, которое последовательно применено во всех файлах конфигурации труб. Это подтверждает намеренность архитектурного изменения для поддержки наложения устройств.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Поиск всех сущностей, наследующихся от GasPipeBase
ast-grep --pattern 'parent: GasPipeBase'

Length of output: 525


Script:

#!/bin/bash
# Search for PipeRestrictOverlap in pipe-related files
rg "PipeRestrictOverlap" Resources/Prototypes/Entities/Structures/Piping/

Length of output: 587

Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml (2)

218-219: Проверьте игровой баланс.

Удаление компонента PipeRestrictOverlap позволит размещать термомашины поверх труб. Убедитесь, что это изменение не создаст нежелательных комбинаций или эксплойтов в игровом процессе.


398-399: Необходимо тестирование размещения конденсаторов.

Удаление ограничений на размещение конденсаторов должно быть тщательно протестировано, особенно в сочетании с другими атмосферными устройствами. Рекомендуется проверить:

  • Корректность работы конденсатора при размещении на трубах
  • Взаимодействие с другими устройствами в той же клетке

@Rxup Rxup merged commit 2c659d4 into Rxup:master Jan 25, 2025
16 checks passed
@BasedUser
Copy link
Contributor

BasedUser commented Feb 1, 2025

Вообще, это всё должно лежать в неймспейсе губов, а не Бакмэна. Авторство тут ещё и расхуярено по полной, нужно было коммитить с:

Pipe stacks
# бла бла бла допустим скваш
Co-authored-by: router <[email protected]>
Co-authored-by: Ilya246 <[email protected]>

А так похуй. :roflanEbalo:

@Roudenn
Copy link
Contributor Author

Roudenn commented Feb 1, 2025

Вообще, это всё должно лежать в неймспейсе губов, а не Бакмэна. Авторство тут ещё и расхуярено по полной, нужно было коммитить с:

Pipe stacks
# бла бла бла допустим скваш
Co-authored-by: router <[email protected]>
Co-authored-by: Ilya246 <[email protected]>

А так похуй. :roflanEbalo:

Простите так нам удобнее апстримиться

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants